package com.lahuan.config.consumer;

import com.alibaba.fastjson.JSON;
import com.lahuan.demo.entity.Order;
import io.github.majusko.pulsar.annotation.PulsarConsumer;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.jms.annotation.JmsListener;
import org.springframework.stereotype.Component;

@Component
public class Consumer {

    @RabbitListener(queues = "queue1")
    @RabbitHandler
    public void getQueue1Message(String msg) {
        System.out.println("rabbit 收到一条信息:"+msg);
    }

    @JmsListener(destination = "week15.destAmq")
    public void getQueue(String info) {
        System.out.println("amq 收到一条信息:"+info);
    }

    @PulsarConsumer(topic="my-topic",clazz = Order.class)
    public void consume(Order message) {
        System.out.println("pulsar 收到一条信息:"+ JSON.toJSONString(message));
    }
}